CSharpTest.Net
EventHandlerForControl<TEventArgs> Constructor(Control,EventHandler<TEventArgs>)
See Also  Example Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.Delegates Namespace > EventHandlerForControl<TEventArgs> Class > EventHandlerForControl<TEventArgs> Constructor : EventHandlerForControl<TEventArgs> Constructor(Control,EventHandler<TEventArgs>)

control
handler

Glossary Item Box

Constructs an EventHandler for the specified method on the given control instance.

Syntax

Visual Basic (Declaration) 
Public Function New( _
   ByVal control As Control, _
   ByVal handler As EventHandler(Of TEventArgs) _
)
C# 
public EventHandlerForControl<TEventArgs>( 
   Control control,
   EventHandler<TEventArgs> handler
)

Parameters

control
handler

Example

Library/Library.Test/TestDelegates.cs

C#Copy Code
EventHandler<VerifiedReceiptEventArgs> handler;
VerifiedReceiptEventArgs args = new VerifiedReceiptEventArgs();

_thread.Start();
_form.FormCreated.WaitOne();

try
{
    handler = new EventHandlerForControl<VerifiedReceiptEventArgs>(_form, CloseTheForm);
    handler(null, args);
}
finally
{
    _thread.Join();
}
VB.NETCopy Code
Dim handler As EventHandler(Of VerifiedReceiptEventArgs)
Dim args As New VerifiedReceiptEventArgs()

_thread.Start()
_form.FormCreated.WaitOne()

Try
    handler = New EventHandlerForControl(Of VerifiedReceiptEventArgs)(_form, CloseTheForm)
    handler(Nothing, args)
Finally
    _thread.Join()
End Try

Requirements

Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7

See Also

Generated with Document! X 2011 by Innovasys